/* cpd.t   CUSTOMER ITEM MASTER DELETE TRIGGER                        */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :cpd.t                                                   */
/*  Author  :Gurgen Mkhitaryan (gym)                                 */
/*  Date    :10/17/96                                                */
/*  !Description : cp_mstr DELETE trigger program                    */
/*          : In order to enhance this trigger to support specific   */
/*          : interfaces, add a DO-END block to (1) check for the    */
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.6          Last Modified:  10/17/96 BY: gym     *K015*  */
/*Revision 8.6          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/11/00 BY: *N0KK* jyn       */
/*                                                                   */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF CP_MSTR.


        {mfdeclre.i}
        define new shared work-table wf_old_cp_mstr like cp_mstr.
        define new shared variable w-recid as recid.
        define variable w-file as character format "x(24)".

        WI: /* Warehousing Interface processing                              */
        do:
          /* If there's no active external warehouse flagged to receive     */
          /* customer item export transactions, do not process  */
          if not can-find(first whl_mstr no-lock
              where whl_mstr.whl_act
                and whl_mstr.whl_cust_item_nbr_exp)
          then leave WI.

          /* Move key cp_mstr values to work table for processing        */
          assign w-recid = recid(cp_mstr).
          create wf_old_cp_mstr.
          if recid(wf_old_cp_mstr) = -1 then .
          assign
                wf_old_cp_mstr.cp_cust      = cp_mstr.cp_cust
                wf_old_cp_mstr.cp_cust_part = cp_mstr.cp_cust_part.

          /* Call subprogram to create export transactions for warehouse */
          w-file = "wicpd.p".
/*J1DM*/ /* {gprun.i ""wicpd.p""} */
/*J1DM*/    {gprunmo.i &module="WI"
                       &program="wicpd.p"}

        end. /* WI */

HK:
do:
    if can-find(first dt_mstr where dt_table = "cp_mstr" and dt_type = "SYNC") then
        run CreateSyncFlag(input "DEL", input recid(cp_mstr), input "cp_mstr").
end.

{hkdttrans.i}
